import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useCookie = defineStore(
  'cookie',
  () => {

    const cookie = ref('')


    const updateCookie = newCookie => {
      cookie.value = newCookie
    }

    const removeCookie = () => {
      cookie.value = null
    }
    return {
      cookie,
      updateCookie,
      removeCookie
    }
  },
  {
    persist: {
      enabled: true,
      //持久化到localStorage
      strategies: [
        {
          storage: window.localStorage,
          key: 'cookie'
        }
      ]
    }
  }
)


